<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .input-col-m {
                width: 60px;
            }

            .input-col-l {
                width: 80px;
            }

            .input-col-xxl {
                width: 1%;
                text-align: right;
            }

            .col-95 {
                text-align: right;
            }

            .col-5 {
                text-align: left;
            }
        </style>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>

    </ui:define>

    <ui:define name="content">
        <div style="margin:5px;">
            <p:growl id="msgs" showDetail="false"/>
            <h:form id="form">

                <p:panel id="input" header="【计划用款补账】表单">
                    <h:panelGrid columns="2" cellspacing="2" style="width: 100%">
                        <h:panelGrid columns="1" cellspacing="2" style="width: 80%">
                            <p:fieldset legend="付款方信息">
                                <h:panelGrid columns="1">
                                    <h:panelGrid columns="4" cellspacing="2" style="width: 100%"
                                                 columnClasses="col-95,col-5,col-95,col-5">
                                        <h:outputLabel value="*凭证号:" for="docNo"/>
                                        <p:inputText id="docNo" value="#{biplanAction.paramPlan.docNo}"
                                                     style="width:160px;" required="true" requiredMessage="必须输入凭证号！"/>

                                        <h:outputLabel value="* 付款房产商:" for="companyName" style="margin-left:20px;"/>
                                        <h:inputText autocomplete="off" id="companyName" style="width:160px;"
                                                     required="true"
                                                     requiredMessage="必须输入付款房产商！"
                                                     value="#{biplanAction.paramPlan.companyName}"
                                                     onfocus="this.select()">
                                        </h:inputText>

                                        <h:outputLabel value="*付款监管账号:" for="accountCode"/>
                                        <p:inputText autocomplete="off" id="accountCode" style="width:160px;"
                                                     required="true"
                                                     requiredMessage="必须输入付款监管账号！"
                                                     value="#{biplanAction.paramPlan.accountCode}">
                                        </p:inputText>

                                        <h:outputLabel value="*申请金额:" for="applyAmt" style="margin-left:20px"/>
                                        <p:inputText autocomplete="off" id="applyAmt" style="width:160px;"
                                                     required="true"
                                                     requiredMessage="必须输入申请金额！"
                                                     value="#{biplanAction.paramPlan.accountCode}">
                                        </p:inputText>
                                    </h:panelGrid>
                                    <h:panelGrid columns="2" cellspacing="2" style="width: 100%" columnClasses="col-95,col-5">
                                        <h:outputLabel value="申请事由:" for="applyReason" style="text-align: right;margin-left: 29px;"/>
                                        <p:inputText autocomplete="off" id="applyReason" style="width:427px;"
                                                     value="#{biplanAction.paramPlan.accountCode}">
                                        </p:inputText>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:fieldset>


                            <p:fieldset legend="用款计划">
                                <h:panelGrid columns="4" cellpadding="2" columnClasses="col-95,col-5,col-95,col-5"  style="width: 100%">
                                    <h:outputLabel value="计划编号:" for="planNo" style="margin-left: 16px;"/>
                                    <p:inputText id="planNo" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="计划金额:" for="planAmt" style="margin-left: 10px;"/>
                                    <p:inputText id="planAmt" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="可用金额:" for="avAmt" style="margin-left: 16px;"/>
                                    <p:inputText id="avAmt" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel/><h:outputLabel/>
                                </h:panelGrid>
                            </p:fieldset>

                            <p:fieldset legend="收款方信息">
                                <h:panelGrid columns="4" cellpadding="2" columnClasses="col-95,col-5,col-95,col-5"  style="width: 100%">
                                    <h:outputLabel value="收款方账号:" for="toAccountCode" style="margin-left: 7px;"/>
                                    <p:inputText id="toAccountCode" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="收款方户名:" for="toAccountName"/>
                                    <p:inputText id="toAccountName" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="可用金额:" for="avAmt" style="margin-left: 7px;"/>
                                    <p:inputText id="avAmt" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="收款行:" for="toBankId"/>
                                    <p:inputText id="toBankId" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel value="收款行全称:" for="toBankName" style="margin-left: 7px;"/>
                                    <p:inputText id="toBankName" value="#{biplanAction.paramPlan.docNo}"
                                                 style="width:160px;"/>
                                    <h:outputLabel/><h:outputLabel/>
                                </h:panelGrid>
                            </p:fieldset>
                        </h:panelGrid>

                        <h:panelGrid style="width: 20%">
                            <p:commandButton id="saveBtn" ajax="true" value="保存"
                                             action="#{biplanAction.onQuery}"
                                             style="margin-left:15px;width:90px"
                                             update="input,pdt,msgs">
                            </p:commandButton>
                            <p:commandButton ajax="true" id="resetBtn" value="重置" action="#{biplanAction.onPrint}"
                                             style="width:90px;margin-left:15px" update="input,msgs"/>
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>

                <p:dataTable id="pdt" style="width:100%;"
                             dynamic="true" selectionMode="single"
                             value="#{biplanAction.biPlanList}" var="record"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true" rows="15" paginatorPosition="bottom"
                             rowsPerPageTemplate="100,50,30,15,5"
                             emptyMessage="数据记录为空...">

                    <p:column headerText="凭证号" style="text-align:center">
                        <h:outputText value="#{record.docNo}"/>
                    </p:column>

                    <p:column headerText="付款开发商" style="text-align:center">
                        <h:outputText value="#{record.companyName}"/>
                    </p:column>

                    <p:column headerText="付款监管账号" style="text-align:center">
                        <h:outputText value="#{record.accountCode}"/>
                    </p:column>

                    <p:column headerText="收款方户名" style="text-align:left">
                        <h:outputText value="#{record.toAccountName}"/>
                    </p:column>

                    <p:column headerText="收款方账号" style="text-align:center">
                        <h:outputText value="#{record.toAccountCode}"/>
                    </p:column>

                    <p:column headerText="申请金额" style="text-align:center">
                        <h:outputText value="#{record.applyAmt}" style="float:right">
                            <f:convertNumber pattern="#,###,###,###,00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="状态标志" style="text-align:left">
                        <h:outputText value="#{record.tradeStatusFlag}"/>
                    </p:column>

                    <p:column headerText="申请人" style="text-align:center">
                        <h:outputText value="#{record.applyOperName}"/>
                    </p:column>

                    <p:column headerText="申请日期" style="text-align:center">
                        <h:outputText value="#{record.applyDate}"/>
                    </p:column>

                </p:dataTable>
            </h:form>
        </div>
    </ui:define>

</ui:composition>